package com.diaosidadui.test02;

import java.util.Scanner;

public class Test06 {
    public static void main(String[] args) {

        String name = "abc";
        String passWord = "345";
        Scanner sc = new Scanner(System.in);

        int count = 0;
        for (int i = 0; i < 5; i++) {
            System.out.print("请输入用户名:");
            String getName = sc.next();
            System.out.print("请输入密码:");
            String getPassWord = sc.next();
            boolean isSucceed = "abc".equals(getName) && "345".equals(getPassWord);
            if (isSucceed) {
                System.out.println("成功");
                break;
            } else {
                count++;

                if (count == 4) {
                    System.out.println("错误次数超限");
                    break;
                } else {
                    System.out.println("剩余"+ (4-count)+"次机会");
                    System.out.println("用户名密码错误,请重试");

                }


            }
        }
    }
}
